import {fileURLToPath, URL} from 'url'

import {defineConfig} from 'vite'
import vue from '@vitejs/plugin-vue'

export default defineConfig({
    plugins: [
        vue(),
    ],
    base: './',
    resolve: {
        alias: {
            '@': fileURLToPath(new URL('./src', import.meta.url))
        }
    },
    server: {
        open: true,
        port: 5000,
        host: '0.0.0.0',
        hmr: true,
        proxy: {
            '/api': {
                // target: 'https://www.oceanread.net:1102',
                target: 'http://localhost:1102',
                changeOrigin: true,
                rewrite: (path) => path.replace(/^\/api/, '')
            },
            '/java': {
                target: 'http://124.70.20.171:8088',
                // target: 'http://localhost:8080',
                changeOrigin: true,
                rewrite: (path) => path.replace(/^\/java/, '')
            },
        }
    },
    build: {
        chunkSizeWarningLimit: 20000
    },
})
